//
//  df.h
//  里
//
//  Created by 众里寻TA on 14-11-25.
//  Copyright (c) 2014年 姜小琦. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#import "StorageUtil.h"

typedef enum  {
    topToBottom = 0,//从上到下
    leftToRight = 1,//从左到右
    upleftTolowRight = 2,//左上到右下
    uprightTolowLeft = 3,//右上到左下
}GradientType;

typedef enum  {
    NotificationJieDan          = 101,
    NotificationQuDan           = 102,
    NotificationChaoShi         = 103,
    Notificationyiyuan          = 104,
    Notificationyiyuannew       = 105,
    
}NotificationStatus;

//#import "RegexKitLite.h"
@interface df : NSObject<UIAlertViewDelegate,CAAnimationDelegate>
{
    UIView *showWaitingView;
    UIView *myview;
}
//字典对象转为实体对象
//+(void)reflectDataFromOtherObject:(NSDictionary *)dic entity:(id)entity;
/*!
 * @brief 把字典转换成模型，模型类名为className
 * @param dict 字典对象
 * @param className 类名
 * @return 返回数据模型对象
 */
+ (id)modelWithDict:(NSDictionary *)dict className:(NSString *)className;

//实体对象转为字典对象
+(NSDictionary*)getObjectData:(id)obj;

+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

+(NSString *) converUrl:(NSString *)url;
//图片压缩
+(UIImage *) imageCompressForWidth:(UIImage *)sourceImage targetWidth:(CGFloat)defineWidth;

+ (UIImage *)imageByScalingToSize:(CGSize)targetSize imagename:(UIImage *)image;

+(CGFloat) getConfigByName:(NSString *)name defaultValue:(CGFloat)defaultValue;

+(NSString *) getNumFromFileByName:(NSString *)filename name:(NSString *)name;

+(BOOL) hasPraised:(NSString *)chatname isClickPraised:(BOOL)isClickPraised;
+ (CGRect)getheightWithContext:(NSString *)context label:(UILabel *)label;
#pragma mark 根据size截取图片中间矩形区域的图片 这里的size是正方形
+(UIImage *)cutCenterImage:(UIImage *)image size:(CGSize)size;
// 设置视图的边框 圆角及 颜色
+(void )layerWithView:(UIView *)view radius:(CGFloat)cornerRadiu width:(CGFloat)borderWidth color:(UIColor *)borderColor;
/**
 *设置view阴影
 *
 */
+(void)setTheViewYiYing:(UIView *)vi shadowColor:(UIColor *)color shadowOffset:(CGSize)ssize apla:(CGFloat)apl;
//添加手势
+(UITapGestureRecognizer *)addTapGestureRecognizerWithTarget:(id)target action:(SEL)action andaddView:(UIView *)view;
//提示框
+(UIAlertView *)showAlertWithTitle:(NSString *)title message:(NSString *)message btn1:(NSString *)btn1 btn2:(NSString *)btn2 btn3:(NSString *)btn3 delegate:(id)object tag:(NSInteger)tag;
//获取数字键盘
+ (void)getKeyboardPodWithTextfield:(UITextField *)textfield isKeyboard:(BOOL)iskeyboard isSecureEntry:(BOOL)secureEntry;

//是否隐藏tarbar
+ (void)isRemoveTarbar:(BOOL)isremove;
//返回首页控制器
+ (void)gotoTheFirstVC;
//label自适应高度
+ (CGRect)labelHeightWithContent:(NSString *)content width:(CGFloat )width label:(UILabel *)label;
//label自适应高度
+ (CGRect)labelHeightWithContent:(NSString *)content width:(CGFloat )width font:(float )font;
//label自适应宽度
+ (CGRect)labelHeightWithContent:(NSString *)content height:(CGFloat )height label:(UILabel *)label;
//label自适应宽度
+ (CGRect)labelHeightWithContent:(NSString *)content height:(CGFloat )height font:(CGFloat)font;
+ (CGRect)textfieldHeightWithContent:(NSString *)content height:(CGFloat )height textfield:(UITextField *)label;
+ (void)gotoLoginVC:(UINavigationController *)nav;
+(void)gotoMainViewController;
//菊花
+(UIActivityIndicatorView *)showWaiting:(UIView *)parent;
//消除滚动轮指示器
+(void)hideWaiting:(UIView *)parent;

//32位MD5加密方式
+ (NSString *)getMd5_32Bit_String:(NSString *)srcString;

//从十六进制字符串获取颜色，
//color:支持@“#123456”、 @“0X123456”、 @“123456”三种格式
+ (UIColor *)colorWithHexString:(NSString *)color alpha:(CGFloat)alpha;
//设置单个字体的颜色
+ (void)fuwenbenLabel:(UILabel *)labell FontNumber:(id)font AndRange:(NSRange)range AndColor:(UIColor *)vaColor;

//设置不同字体颜色
+ (void)fuwenbenLabel:(UILabel *)labell FontNumber:(id)font AndRange1:(NSRange)range1 AndRange2:(NSRange)range2 AndColor1:(UIColor *)vaColor1 AndColor2:(UIColor *)vaColor2;

//判断是汉字还是字母
+ (BOOL)isChinesecharacter:(NSString *)string;
//计算汉字的个数
+ (NSInteger)chineseCountOfString:(NSString *)string;
//计算字母的个数
+ (NSInteger)characterCountOfString:(NSString *)string;
//获取系统语言
+ (NSString *)getCurrentLanguage;
//获取系统IP
+ (NSString *)deviceIPAdress;
//获取APP
+ (NSString *)APPID;
//抛物线动画
+ (void)donghuaOfPaoWuXian:(CGFloat)startx stary:(CGFloat)stary endx:(CGFloat)endx endy:(CGFloat)endy superView:(UIView *)fatherView;
//一像素的线
+ (void)lineViewWithHeightofTop:(CGFloat)heihtoftop superView:(UIView *)fatherView spacing:(CGFloat)spacing color:(UIColor *)color lineHeight:(CGFloat)height;
+ (void)lineViewWithWidthtofLeft:(CGFloat)widthofleft superView:(UIView *)fatherView spacing:(CGFloat)spacing color:(UIColor *)color lineWidth:(CGFloat)width;
+ (UIView *)newlineViewWithHeightofTop:(CGFloat)heihtoftop superView:(UIView *)fatherView spacing:(CGFloat)spacing color:(UIColor *)color lineHeight:(CGFloat)height;

+ (void)lineViewWithHeightofTop:(CGFloat)heihtoftop superView:(UIView *)fatherView spacing:(CGFloat)spacing image:(UIImage *)imagename lineHeight:(CGFloat)height;
//  将数组重复的对象去除，只保留一个
+ (NSArray *)arrayWithMemberIsOnly:(NSArray *)array;
+ (NSArray *)arrayObjectOfStringWithMemberIsOnly:(NSArray *)array;
//数组转换成字符串
+ (NSString *)arrayTransformStringWithArray:(NSArray *)array;
/**
 *  渐变色
 */
+(void)jianbianse:(UIView *)view beginColor:(UIColor *)bColor midColor:(UIColor *)mColor endColor:(UIColor *)eColor ByGradientType:(GradientType)gradientType;

+ (void) viewImageFromColors:(NSArray*)colors ByGradientType:(GradientType)gradientType view:(UIView *)vi;

/**
 *  根据点击的坐标获取 imageV 上的颜色
 */
+ (NSString *)colorAtPixel:(CGPoint)point imageView:(UIImageView *)imageV;
/**
 *  渐变的动画
 */
+ (void)jianbianAnimoWithDelegate:(id)obj addView:(UIView *)views;
/**
 *  翻转的动画
 */
+(void)fanzhuanAnimoAddView:(UIView *)views;


+ (void)getImageView:(UIView *)fatherV isbigImaga:(NSString *)ishave;
+ (void)removeImageView:(UIView *)fatherV;


/**
 *  生成二维码
 */
+ (CIImage *)createQRForString:(NSString *)qrString;
//因为生成的二维码是一个CIImage，我们直接转换成UIImage的话大小不好控制，所以使用下面方法返回需要大小的UIImage：
+ (UIImage *)createNonInterpolatedUIImageFormCIImage:(CIImage *)image withSize:(CGFloat) size;

/**
 *  清理缓存
 */

+(float)folderSizeAtPath;
+(void)clearCache;

/**
 *  show 通知view
 */

+ (UIView *)showTongZhi:(NSString *)title father:(UIView *)father;

+ (NSString *)getString:(id)recevicer;
+ (NSString *)getintToString:(NSInteger)recevicer;
+ (UIViewController*)viewController:(UIView *)view;

#pragma mark  showBigImageV
+ (UIView *)getBigImageViewWithImageURL:(NSString *)url;
//转换成当前时刻
+ (NSString *)timeFormatted:(int)totalSeconds;

//*prame mark
//弹出键盘 改变cell 位置
//*
+ (void)changeCellPointwithKeyboardHeight:(CGFloat)keyboardH touchTextfield:(id)textfield tabelView:(UITableView *)tabelView;
+(BOOL)isLogin;

+(UIImage*) createImageWithColor:(UIColor*) color;

+(CGFloat)getSpaceLabelLineSpacing:(CGFloat)spacing withFont:(UIFont*)font withLabel:(UILabel *)label; 
@end
